rem 使用前需建立网桥docker:172.18.0.0/16
@echo off

cd /d %~dp0

set COMPOSE_CONVERT_WINDOWS_PATHS=1

if not exist %cd%\conf (
    mkdir %cd%\conf
)

if not exist %cd%\conf\zoo.cfg (
    rem 获取默认配置文件并覆盖
    docker run -itd --name zookeeper zookeeper
    docker cp zookeeper:/conf/zoo.cfg %cd%\conf
    docker stop zookeeper
    docker rm zookeeper
)

rem 运行容器
docker run -itd --name zookeeper ^
	--net=docker --ip=172.18.2.1 ^
	--restart=always ^
	-p 2181:2181 ^
	-v %cd%\data:/data ^
	-v %cd%\datalog:/datalog ^
	-v %cd%\logs:/logs ^
	-v %cd%\conf\zoo.cfg:/conf/zoo.cfg ^
	-e ZOO_LOG4J_PROP="INFO,ROLLINGFILE" ^
	zookeeper